<cfsetting enablecfoutputonly="Yes">

<!--- 
  /**
   * @author  <info@mireau.net>
   * @version 1.0 - <yyyy/mm/dd>
   */
--->

<cftry>

  <cfif not directoryExists( "#request.site.s_ANCHOR_PATH#/www/#attributes.sDir#" )>
    <cfdirectory 
      action="create"
      directory="#request.site.s_ANCHOR_PATH#/www/#attributes.sDir#"
    >

    <cffile 
      action="READ" 
      file="#request.site.s_ANCHOR_PATH#/lib/templates/system/_index_.tpl"
      variable="local.sFileContents"
    >
    
    <cfscript>
      local.sDate = datePart( "yyyy", now()) & "/" &
                    numberFormat( datePart( "m", now()), "00" ) & "/" &
                    numberFormat( datePart( "d", now()), "00" );
                    
      local.sFileContents = replace( local.sFileContents, "%[EMAIL_ADDRESS]%",  "info@mireau.nl", "all" );
      local.sFileContents = replace( local.sFileContents, "%[DATE]%",           local.sDate, "all" );
    </cfscript>

    <cffile 
      action="write" 
      file="#request.site.s_ANCHOR_PATH#/www/#attributes.sDir#/index.cfm" 
      output="#local.sFileContents#" 
      addnewline="No"
    >
  </cfif>

  <cfcatch>
    <cfif request.dev.b_DBUG>
      <cfdump var="#cfcatch#">
      <cfabort>
    <cfelse>
      <cflocation url="#request.site.s_WEBROOT#/?nStatus=#request.status.n_ERROR_CREATING_DIR#" addtoken="no">
    </cfif>
  </cfcatch>
</cftry>

<cfsetting enablecfoutputonly="No">
